#ifndef __UART_INTERFACE_H
#define __UART_INTERFACE_H

#include "main.h"

#include "FreeRTOS.h"
#include "semphr.h"
#include "queue.h"


struct uart_device {
	char *name;
	char (*init)(struct uart_device * pdev, unsigned int baud, unsigned char data_bits, unsigned char stop_bits, unsigned char parity);
	char (*send)(struct uart_device * pdev, char *data, unsigned int len, unsigned char timeout);
	char (*recv)(struct uart_device * pdev, char *data, unsigned char timeout);
	void *priv_data;
};

struct priv_data {
	UART_HandleTypeDef * pUart;
	SemaphoreHandle_t pMutex;
	QueueHandle_t pQueue;
	unsigned char pData;
};


struct uart_device * find_dev(char * name);


#endif
